package com.infoDiffusion.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;
import org.springframework.beans.factory.annotation.Autowired;

import com.infoDiffusion.bean.EarthquakeBean;
import com.infoDiffusion.bean.EmergencyBean;
import com.infoDiffusion.bean.HydroStatBean;
import com.infoDiffusion.bean.KnowledgeBean;
import com.infoDiffusion.bean.UserBean;
import com.infoDiffusion.bean.WeatherInfoBean;
import com.infoDiffusion.service.AllEventService;
import com.infoDiffusion.util.Constants;
import com.opensymphony.xwork2.ActionContext;

public class AllEventAction {
	@Autowired
	AllEventService allEventService;
	EarthquakeBean earthquakeBean;
	HydroStatBean hydroStatBean;
	WeatherInfoBean weatherInfoBean;
	EmergencyBean emergencyBean;
	UserBean bean;
	public HttpServletResponse response = ServletActionContext.getResponse();
	public HttpServletRequest request = ServletActionContext.getRequest();
	public HttpSession session = request.getSession();

	String title = request.getParameter("title");
	

	public String search() {
		//模糊匹配地震信息
		List<EarthquakeBean> list1 = allEventService.listelike(title);
		ActionContext.getContext().put("list1", list1);
		System.out.println(list1.toString());
//		模糊匹配水文信息
		List<HydroStatBean> list2 = allEventService.listhlike(title);
		ActionContext.getContext().put("list2", list2);
//		模糊匹配气象信息
		List<WeatherInfoBean> list3 = allEventService.listwlike(title);
		ActionContext.getContext().put("list3", list3);
//		模糊匹配应急知识
		List<KnowledgeBean> list4 = allEventService.listklike(title);
		ActionContext.getContext().put("list4", list4);
//		模糊匹配突发事件
		List<EmergencyBean> list5 = allEventService.listemlike(title);
		ActionContext.getContext().put("list5", list5);
		return "list";
	}

	public EarthquakeBean getEarthquakeBean() {
		return earthquakeBean;
	}

	public void setEarthquakeBean(EarthquakeBean earthquakeBean) {
		this.earthquakeBean = earthquakeBean;
	}

	public HydroStatBean getHydroStatBean() {
		return hydroStatBean;
	}

	public void setHydroStatBean(HydroStatBean hydroStatBean) {
		this.hydroStatBean = hydroStatBean;
	}

	public WeatherInfoBean getWeatherInfoBean() {
		return weatherInfoBean;
	}

	public void setWeatherInfoBean(WeatherInfoBean weatherInfoBean) {
		this.weatherInfoBean = weatherInfoBean;
	}

	public UserBean getBean() {
		return bean;
	}

	public void setBean(UserBean bean) {
		this.bean = bean;
	}

	public EmergencyBean getEmergencyBean() {
		return emergencyBean;
	}

	public void setEmergencyBean(EmergencyBean emergencyBean) {
		this.emergencyBean = emergencyBean;
	}
	
}
